const http = require('http');

// 创建http服务
const server = http.createServer((req, res) => {

    let body = ''
    req.on('data', (chunk) => {
        body += chunk;
    })

    req.on('end', () => {
        console.log('------------body--------------');
        console.log(body);
        console.log('------------body--------------');

        // 设置响应头
        res.setHeader('Content-Type', 'text/plain; charset=utf-8');
        // 设置响应体
        res.end('hello,你好,123')
    })

})

// 监听9000端口
server.listen(9000, () => {
    console.log('服务启动了');
})